package com.sky.wsp.camel;

import cn.hutool.core.io.file.FileReader;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @desccription 针对JavaBean属性、getr/set方法，实现snake风格转换为camel风格
 * @auth wangshaopeng@talkweb.com.cn
 * @date 2022/12/20
 */
public class IdSplitUtils03 {

    private static String sourcePath = "C:\\Users\\24044\\Desktop\\30\\29sql-update-inn_dps_wiki_node.sql";
    private static Integer count = 0;

    public static void main(String[] args) {
        System.out.println("开始处理...");
        FileReader fileReader = new FileReader(sourcePath);
        Set<String> idSet = new HashSet<>();
        List<String> lines = fileReader.readLines();
        if (lines.isEmpty()) {
            return;
        }
        for (String l : lines) {
            count++;
            String[] split = l.split(" WHERE ");
            if (split.length != 2) {
                System.out.println(count + " 跳过: " + l);
                continue;
            }
            String[] split2 = split[1].split("`id`=");
            String nextStr = split2[1];
            String id = nextStr.split(" ")[0];
            idSet.add(id);
        }
        for (String id : idSet) {
            System.out.println("'" + id + "',");
        }
        System.out.println("================总共处理" + "【" + count + "】行SQL!!!=======================");
    }
}
